import request from '@/utils/request'

/**
 * 获取分页销售机会列表
 * @returns {Promise<PageDTO<SalesOpportunitiesVO>} 返回分页销售机会数据
 */
export function getOpportunitiesList(params) {
  return request({
    url: '/sales-opportunity/list',
    method: 'get',
    params
  })
}

/**
 * 添加销售机会
 * @param {SalesOpportunitiesDTO} data 添加销售机会数据\
 */
export function addOpportunity(data) {
  return request({
    url: '/sales-opportunity',
    method: 'post',
    data
  })
}

/**
 * 修改销售机会
 * @param {SalesOpportunitiesDTO} data 修改销售机会数据\
 */
export function updateOpportunity(data) {
  return request({
    url: '/sales-opportunity',
    method: 'put',
    data
  })
}

/**
 * 删除销售机会
 */
export function deleteOpportunities(ids) {
  return request({
    url: '/sales-opportunity',
    method: 'delete',
    data: ids
  })
}

export default { 
  getOpportunitiesList, 
  addOpportunity, 
  updateOpportunity,
  deleteOpportunities
}
